{template 'web/_header'}
{template 'web/allorder/fightgroups_tabs'}
<style type='text/css'>
    .trbody td {text-align: center; vertical-align:top;border-left:1px solid #ccc; border-bottom: 1px solid #ddd;}
</style>
<style type="text/css">
    .main .form-horizontal .form-group{margin-bottom:0;}
    .main .form-horizontal .modal .form-group{margin-bottom:15px;}
    #modal-confirmsend .control-label{margin-top:0;}
</style>
<div class="main">
    <form class="form-horizontal form" action="" method="post" enctype="multipart/form-data" onsubmit="return formcheck(this)">
        <input type="hidden" name="dispatchid" value="{$dispatch['id']}" />
        <div class="panel panel-default">
            <div class="panel-heading">
                订单信息
            </div>
            <div class="panel-body">
                <div class="form-group">

                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">粉丝</label>

                    <div class="col-sm-9 col-xs-12">

                        <img src='{$item['userinfo']['avatar']}' style='width:100px;height:100px;padding:1px;border:1px solid #ccc' />

                             {$item['userinfo']['nickname']}

                    </div>

                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">订单类型 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">
                            {if $item['is_tuan']==1 || $item['is_tuan']==3}<span class="label label-warning">拼团单：{$item['tuan_id']}号</span>
                            {elseif $item['is_tuan']==0}<span class="label label-success">直购单</span>
                            {elseif $item['is_tuan']==2}<span class="label label-default">团满退款单</span>
                            {/if}
                        </p>
                    </div>
                </div>
                {if $item['is_usecard']==1}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">优惠券 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">
                            已抵用<font color="brown">{php echo $item['pay_price']-$item['price']}元</font>
                        </p>
                    </div>
                </div>
                {/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">实际支付 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['price']} 元 （运费: {$item['freight']} 元)</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">订单号 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['orderno']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">付款方式 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">
                            {if $item['pay_type'] == 0}
                            <span class="label label-danger">未支付</span>
                            {/if}
                            {if $item['pay_type'] == 1}
                            <span class="label label-info">余额支付</span>
                            {/if}
                            {if $item['pay_type'] == 2}
                            <span class="label label-success">微信支付</span>
                            {/if}
                            {if $item['pay_type'] == 3}
                            <span class="label label-info">待付款</span>
                            {/if}
                        </p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">微信订单号 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['transid']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">订单状态 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">
                            {if $item['status'] == 0}<span class="label label-default">待付款</span>{/if}
                            {if $item['status'] == 1}<span class="label label-info">已支付</span>{/if}
                            {if $item['status'] == 2}<span class="label label-warning">待发货</span>{/if}
                            {if $item['status'] == 3}<span class="label label-success">待收货</span>{/if}
                            {if $item['status'] == 4}<span class="label label-success">已签收</span>{/if}
                            {if $item['status'] == 5}<span class="label label-default">已取消</span>{/if}
                            {if $item['status'] == 6}<span class="label label-danger">待退款</span>{/if}
                            {if $item['status'] == 7}<span class="label label-success">已退款</span>{/if}
                        </p>
                        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-getgoods2">修改订单状态</button>
                    </div>
                </div>
                <!--修改订单状态-->
                <div id="modal-getgoods2" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" style="width:600px;margin:0px auto;">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                <h3>修改收货信息</h3>
                            </div>
                            <div class="modal-body">
                                <div class="form-group">
                                    <label class="col-xs-10 col-sm-3 col-md-3 control-label">订单状态</label>
                                    <div class="col-xs-12 col-sm-9 col-md-8 col-lg-8">
                                        <select class="form-control" name="thestatus" id="express">
                                            <option value="">选择订单状态</option>
                                            <option value="0" {if $item['status']==0}selected="selected"{/if}>未支付</option>
                                            <option value="1" {if $item['status']==1}selected="selected"{/if}>已支付</option>
                                            <option value="2" {if $item['status']==2}selected="selected"{/if}>待发货</option>
                                            <option value="3" {if $item['status']==3}selected="selected"{/if}>已发货</option>
                                            <option value="4" {if $item['status']==4}selected="selected"{/if}>已签收</option>
                                            <option value="5" {if $item['status']==5}selected="selected"{/if}>已取消</option>
                                            <option value="6" {if $item['status']==6}selected="selected"{/if}>待退款</option>
                                            <!--<option value="7" {if $item['status']==7}selected="selected"{/if}>已退款</option>-->
                                        </select>     
                                    </div>

                                </div>
                                <div class="modal-footer">
                                    <button type="submit" class="btn btn-primary span2" name="editstatus" value="yes">确认修改</button>
                                    <a href="#" class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</a>
                                </div>
                            </div>
                        </div>
                    </div></div>
                <!--修改订单状态-->
                {if !empty($refund_record)}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">退款时间 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{php echo date('Y-m-d H:i:s', $refund_record['createtime'])}</p>
                    </div>
                </div>
                {/if}
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">下单日期 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{php echo date('Y-m-d H:i:s', $item['createtime'])}</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="panel panel-default">
            <div class="panel-heading">
                收货信息
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">姓名 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['addname']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">手机 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['mobile']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">地址 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['address']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">地址类型:</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{if $item['addresstype']==1}公司{else}家庭{/if}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">买家留言：</label>
                    <div class="col-sm-4">
                        <textarea style="height:100px;"  class="form-control description" cols="60">{$item['remark']}</textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-9 col-xs-12 text-right">
                        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-getgoods">修改收货信息</button>
                    </div>

                </div>

            </div>
        </div>
        <!--修改收货信息-->
        <div id="modal-getgoods" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true" style="width:600px;margin:0px auto;">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                        <h3>修改收货信息</h3>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <label class="col-xs-10 col-sm-3 col-md-3 control-label">姓名</label>
                            <div class="col-xs-12 col-sm-9 col-md-8 col-lg-8">
                                <input type="text" name="recvname" class="form-control" value="{$item['addname']}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-10 col-sm-3 col-md-3 control-label">电话</label>
                            <div class="col-xs-12 col-sm-9 col-md-8 col-lg-8">
                                <input type="text" name="recvmobile" class="form-control" value="{$item['mobile']}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-10 col-sm-3 col-md-3 control-label">地址</label>
                            <div class="col-xs-12 col-sm-9 col-md-8 col-lg-8">
                                <input type="text" name="recvaddress" class="form-control" value="{$item['address']}"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-xs-10 col-sm-3 col-md-3 control-label">地址类型</label>
                            <div class="col-xs-12 col-sm-9 col-md-8 col-lg-8">
                                <select class="form-control" name="addresstype" id="express">
                                    <option value="">选择家庭/公司</option>
                                    <option value="2" {if $item['addresstype']==2}selected="selected"{/if}>家庭</option>
                                    <option value="1" {if $item['addresstype']==1}selected="selected"{/if}>公司</option>
                                </select>     
                            </div>

                        </div>
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary span2" name="getgoods" value="yes">确认修改</button>
                            <a href="#" class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</a>
                        </div>
                    </div>
                </div>
            </div></div>
        <!--修改收货地址-->
        <div class="panel panel-default">
            <div class="panel-heading">
                快递信息
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">快递名称 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['express']}</p>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">快递号码 :</label>
                    <div class="col-sm-9 col-xs-12">
                        <p class="form-control-static">{$item['expresssn']}</p>
                    </div>
                </div>

            </div>

        </div>

        <div class="panel panel-default">
            <div class="panel-heading">
                商品信息
            </div>
            <div class="panel-body table-responsive">
                <table class="table table-hover">
                    <thead class="navbar-inner">
                        <tr>
                            <th style="width:5%;">ID</th>
                            <th style="width:15%;">商品标题</th>
                            <th style="width:15%;">商品图片</th>
                            <th style="width:20%;">团购价</th>
                            <th style="width:20%;">单买价</th>
                            <th style="width:15%;">数量</th>
                            <th style="width:10%;">操作</th>
                        </tr>
                    </thead>
                    {loop $item['goods'] $goods}
                    <tr>
                        <td>{$goods['id']}</td>
                        <td>{$goods['gname']}</td>
                        <td>
                            <div style=" width:40px;height:40px;">
                                <img src="{$_W['attachurl']}{$goods['gimg']}" style=" width:40px;height:40px;" alt="" title="">
                            </div>  
                        </td>
                        <td>{$goods['gprice']}元</td>
                        <td>{$goods['oprice']}元</td>
                        <td>{$goods['gnum']}</td>
                        <td>
                            <a href="http://wx.lanxuevip.com/web/index.php?c=site&a=entry&op=edit&do=goods&m=feng_fightgroups&id={$goods['id']}" class="btn btn-default btn-sm" data-toggle="tooltip" data-placement="bottom" title="编辑"><i class="fa fa-edit"></i></a>
                        </td>
                    </tr>
                    {/loop}
                    <tr>
                        <td colspan="10" class="text-right">
                            <button class="btn btn-default" onclick="javascript:history.back(-1);">返回上一页</button>
                            {if empty($item['status'])}
                            <button type="submit" class="btn btn-primary" onclick="return confirm('确认付款此订单吗？');
                                                                return false;" name="confrimpay" value="yes">确认付款</button>
                            {/if}

                            {if $item['status'] == 2}
                            <input type="hidden" name='refund_id' value="{$item['id']}"/>
                            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#modal-confirmsend">确认发货</button>
                            {/if}
                            {if !empty($item['transid'])}

                            {if $item['status'] == 7}
                            <button  class="btn btn-success" >已退款</button>
                            {elseif $item['status']==1 || $item['status']==6 || $item['status']==2 || $item['status']==3 || $item['status']==4}
                            <button type="submit" class="btn btn-success" onclick="return confirm('确认退款此订单吗？');
                                                                        return false;" name="refund" value="yes">退款</button>
                            {/if}
                            {/if}
                            {if $item['status'] == 3}					
                            <button type="button" class="btn btn-danger" name="cancelsend" onclick="$('#modal-cancelsend').modal();" value="yes">取消发货</button>
                            <!--<button type="submit" class="btn btn-success" onclick="return confirm('确认完成此订单吗？'); return false;" name="finish" value="yes">完成订单</button>
                            -->							{/if}	
                            <input type="hidden" name="refund_id" value="{$item['id']}" />
                            <input type="hidden" name="token" value="{$_W['token']}" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        {template 'web/allorder/fightgroups_modals'}
    </form>
</div>
<script language='javascript'>
    $(function(){
      
        {if !empty($express)}
        $("#express").find("option[data-name='{$express['express_name']}']").attr("selecte d",true);
        $("#expresscom").val($("#express").find("option:selected").attr("data-name"));
                {/if}
            $("#express").change(functio n(){
            var obj = $(this);
            var sel = obj.find("option:selected").attr("data-name");
        $("#expresscom").val(sel);
    });
    });
</script>
<script>
        require(['bootstrap '],function ($){
            $('.btn').hover(functio n(){
        $(this).tooltip('show');
            },functio n(){
        $(this).tooltip('hide');
    });
        });
</script>
{template 'web/_footer'}